#include <bits/stdc++.h>
// 2025/04/04
// tag: 
// Author: Forever
using namespace std;
using int64 = int64_t;

string s;
int n, dp[101][101];

inline int bit(int x){
    int res = 0;
    while (x)
        res++, x /= 10;
    return res;
}

inline bool check(int l, int r, int len){
    for (int i = l + len; i <= r; i++)
        if (s[(i - l) % len + l] != s[i])
            return false;
    return true;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> s;
    n = s.size();
    memset(dp, 0x3f, sizeof(dp));
    for (int i = 0; i < n; i++)
        dp[i][i] = 1;
    for (int len = 2; len <= n; len++){
        for (int l = 0, r = len - 1; r < n; l++, r++){
            for (int k = l; k < r; k++)
                dp[l][r] = min(dp[l][r], dp[l][k] + dp[k + 1][r]);
            for (int k = l; k < r; k++){
                int length = k - l + 1;
                if (len % length == 0 && check(l, r, length))
                    dp[l][r] = min(dp[l][r], dp[l][k] + 2 + bit(len / length));
            }
        }
    }
    cout << dp[0][n - 1] << endl;
    return 0;
}